//
//  MBProgressHUD+Helper.h
//  智能备考学习
//
//  Created by 盛超 on 2018/8/14.
//  Copyright © 2018年 盛超. All rights reserved.
//

#import <MBProgressHUD/MBProgressHUD.h>

typedef enum : NSUInteger {
    KZHUDPositionModeTop,
    KZHUDPositionModeCenter,
    KZHUDPositionModeBottom,
} KZHUDPositionMode;

typedef enum : NSUInteger {
    KZHUDStateModeSuccess,
    KZHUDStateModeFailure,
} KZHUDStateMode;

@interface MBProgressHUD (Helper)
/*加载中*/
+ (instancetype)showDefaultToView:(UIView*)view;
/*背景透明*/
+ (instancetype)showClearStyleToView:(UIView*)view;
/*显示错误代码*/
+ (instancetype)showErrorStyleToView:(UIView*)view withCode:(NSInteger)code;
/*显示没有更多数据*/
+ (instancetype)showNoDataStyleToView:(UIView*)view;
/*加载自定义动画*/
+ (instancetype)showCustomAnimationToView:(UIView*)view images:(NSArray *)images title:(NSString*)title;
///*加载自定义gif动画*/
+ (instancetype)showGifAnimationToView:(UIView*)view gif:(NSString *)gif title:(NSString*)title;



// 仅显示文字
+ (void)showOnlyText:(NSString *)text;
+ (void)showOnlyText:(NSString *)text hasMasker:(BOOL)hasMasker;
+ (void)showOnlyText:(NSString *)text position:(KZHUDPositionMode)position;
+ (void)showOnlyText:(NSString *)text position:(KZHUDPositionMode)position duration:(CGFloat)duration;

// 加载中
+ (void)showLoadind:(NSString *)text;
+ (void)showLoadind:(NSString *)text hasMasker:(BOOL)hasMasker;
+ (void)showLoadind:(NSString *)text duration:(CGFloat)duration;


// 成功/失败
+ (void)showText:(NSString *)text state:(KZHUDStateMode)state;
+ (void)showText:(NSString *)text state:(KZHUDStateMode)state duration:(CGFloat)duration;
+ (void)showFailureWithText:(NSString *)text;   // 对上面显示状态的封装
+ (void)showFailureWithText:(NSString *)text hasMasker:(BOOL)hasMasker;
+ (void)showSuccessWithText:(NSString *)text;   // 对上面显示状态的封装
+ (void)showSuccessWithText:(NSString *)text hasMasker:(BOOL)hasMasker;

// 加载进度
typedef void(^KZHUDProgressUpload)(CGFloat progress, BOOL competion);
+ (MBProgressHUD *)showProgress:(NSString *)text action:(void(^)(KZHUDProgressUpload progress))actionBlock;
+ (MBProgressHUD *)showProgress:(NSString *)text action:(void(^)(KZHUDProgressUpload progress))actionBlock hasMasker:(BOOL)hasMasker;

/*
 使用举例
 __block CGFloat p = 0;
 [ByCoreToolAlert showProgress:nil action:^(ByProgressUpload progress) {
 
 // 模拟请求
 dispatch_async(dispatch_get_global_queue(0, 0), ^{
 
 while (p < 1) {
 p += 0.01;
 progress(p, false);
 usleep(50000);
 }
 
 progress(p, true);
 });
 
 }];
 */

// 隐藏hud
+ (void)hideHud;

@end

@interface MBProgressGifImageHUD : UIImageView

@end
